//package com.loong.data.consumer;
//
//import com.alibaba.fastjson.JSON;
//import com.alibaba.fastjson.JSONObject;
//import com.loong.common.rabbitmq.consumer.BaseConsumer;
//import com.loong.common.rabbitmq.dto.GoodsSkuDTO;
//import com.loong.common.rabbitmq.dto.ShopDTO;
//import com.loong.common.rabbitmq.dto.base.RepositoryEventDto;
//import com.loong.data.handler.GoodsSkuHandler;
//import com.loong.data.handler.ShopHandler;
//import com.loong.global.constant.MQConstant;
//import com.rabbitmq.client.Channel;
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.amqp.core.Message;
//import org.springframework.amqp.rabbit.annotation.RabbitListener;
//import org.springframework.stereotype.Component;
//
//import javax.annotation.Resource;
//import java.io.IOException;
//
///**
// * @Description:
// * @Author: LiuQun
// * @Date: 2020-12-5 09:32
// */
//@Slf4j
//@Component
//public class GoodsSkuReportConsumer extends BaseConsumer {
//    @Resource
//    private GoodsSkuHandler goodsSkuHandler;
//
//
//    @RabbitListener(queues = {MQConstant.BASE_PREFIX+MQConstant.QUEUE_NAME.GOODS_SKU+MQConstant.BASE_SUFFIX.QUEUE}, containerFactory = "defaultRabbitListener")
//    public void receiveEvent(Channel channel, Message message) throws IOException {
//        long deliveryTag = message.getMessageProperties().getDeliveryTag();
//        byte[] data = message.getBody();
//        // 消费到商家信息修改
//        log.debug("消费到数据：{}",new String(data));
//        RepositoryEventDto<JSONObject> eventDto = JSON.parseObject(new String(data)).toJavaObject(RepositoryEventDto.class);
//        Short eventCode = eventDto.getEventCode();
//        GoodsSkuDTO goodsSkuDTO = eventDto.getData().toJavaObject(GoodsSkuDTO.class);
//        log.debug("goodsSkuDTO=====>"+goodsSkuDTO.toString());
//        switch (eventCode){
//            case 1:
//                goodsSkuHandler.saveGoodsSku(goodsSkuDTO);
//                break;
//            case 2:
//                goodsSkuHandler.updateGoodsSku(goodsSkuDTO);
//                break;
//            case 3:
//                goodsSkuHandler.deleteGoodsSkuById(goodsSkuDTO.getId());
//                break;
//        }
//        // 存储到ES
//        submitAck(channel,deliveryTag);
//    }
//
//
//}
